package com.shop.domain.user;

import com.alibaba.fastjson.annotation.JSONField;
import com.shop.jpa.domain.BaseDomain;
import com.shop.jpa.support.JpaConst;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>UserRealNameAuth 实体类</p>
 * <p>Table: UserRealNameAuth - 真实姓名认证记录表</p>
 *
 * @author Jerry
 */
@ApiModel("UserRealNameAuth 真实姓名认证记录表")
@Data
@Entity
@EntityListeners(AuditingEntityListener.class)
@Table(name = "t_user_real_name_auth")
@SQLDelete(sql = "update t_user_real_name_auth set is_deleted = 1 where id = ?")
@Where(clause = JpaConst.WHERE_CLAUSE_NOT_DELETED)
@DynamicInsert(true)
@DynamicUpdate(true)
public class UserRealNameAuth extends BaseDomain implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ApiModelProperty(value = "id", hidden = true)
    @Column(name = "id")
    @JSONField(serialize=false)
    private Long id;

    /**
     * 用户id
     */
    @ApiModelProperty("用户id")
    @Column(name = "uid")
    private Long uid;

    /**
     * IP
     */
    @ApiModelProperty("IP地址")
    @Column(name = "ip")
    private String ip;

    /**
     * 身份证号
     */
    @ApiModelProperty("身份证号")
    @Column(name = "id_number")
    private String idNumber;

    /**
     * 真实姓名
     */
    @ApiModelProperty("真实姓名")
    @Column(name = "reality_name")
    private String realityName;

    /**
     * 是否成功
     */
    @ApiModelProperty("是否成功 0 否 1 是")
    @Column(name = "is_success")
    private Integer isSuccess;

    /**
     * 返回信息
     */
    @ApiModelProperty("返回信息")
    @Column(name = "sync_resp")
    @JSONField(serialize = false)
    private String syncResp;

    /**
     * 创建时间
     */
    @Column(name = "create_time")
    @JSONField(format = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 修改时间
     */
    @Column(name = "update_time")
    @JSONField(serialize = false)
    private Date updateTime;

    /**
     * 是否删除 0 否 1 是
     */
    @Column(name = "is_deleted")
    @JSONField(serialize = false)
    private Integer isDeleted;
}